package com.chenzhengrong.demospringboot.excel;

import com.alibaba.excel.context.AnalysisContext;
import com.alibaba.excel.event.AnalysisEventListener;
import com.alibaba.excel.metadata.CellData;
import com.chenzhengrong.demospringboot.excel.pojo.DemoData;
import lombok.extern.slf4j.Slf4j;

import java.util.Map;

/**
 * @author chenzhengrong
 * @title: ExcelListener
 * @description: excel监听器
 * @date 2022/11/8 10:20
 */
@Slf4j
public class ExcelListener extends AnalysisEventListener<DemoData> {

    /*一行行读取excel内容*/
    @Override
    public void invoke(DemoData demoData, AnalysisContext analysisContext) {
        log.info("*****{}", demoData);
    }

    /*读取表头内容*/
    @Override
    public void invokeHeadMap(Map<Integer, String> headMap, AnalysisContext context) {
        log.info("表头：{}", headMap);
    }

    /*读取完之后*/
    @Override
    public void doAfterAllAnalysed(AnalysisContext analysisContext) {

    }
}
